<!DOCTYPE html>
<html>
<head>
<title>科成后台管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="scripts/jquery/jquery-1.7.1.js"></script>
<link href="style/authority/basic_layout.css" rel="stylesheet" type="text/css">
<link href="style/authority/common_style.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap-theme.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="scripts/authority/commonAll.js"></script>
<script type="text/javascript" src="scripts/jquery/jquery-1.4.4.min.js"></script>
<script src="scripts/My97DatePicker/WdatePicker.js" type="text/javascript" defer="defer"></script>
<script type="text/javascript" src="scripts/artDialog/artDialog.js?skin=default"></script>
<script type="text/javascript">
	/** 表单验证  **/
	function validateForm() {
		if ($("#fyXqName").val() == "") {
			art.dialog({
				icon : 'error',
				title : '友情提示',
				drag : false,
				resize : false,
				content : '填写房源小区',
				ok : true,
			});
			return false;
		}
		
	}
</script>
<style type="text/css">
/*单选按钮*/
.gcs-radio {
	display: none;
}

.gcs-radio+label {
	width: 20px;
	height: 20px;
	line-height: 20px;
	display: inline-block;
	text-align: center;
	vertical-align: bottom;
	border: 1px solid gray;
	border-radius: 50%;
	margin-bottom: 0;
}

.gcs-radio+label:hover {
	border: 1px solid #2783FB;
	cursor: pointer;
}

.gcs-radio:checked+label {
	background: #2783FB;
	border: 1px solid #2783FB;
}

.gcs-radio:checked+label:after {
	content: "\2022";
	font-size: 35px;
	color: white;
}
.submit{
	margin-top:20px;
	margin-left: 78px; 
	width: 100px;
	height: 35px;
	background-color: #CDDAEB;
	border: 0.5px solid #044599;
	border-radius: 10px;
	font-weight: bold;
}
.submit:hover{
	font-weight: bold;
	background-color:#044599;
	color: white;
}
</style>
</head>
<body onunload="javascript:window.opener.location.reload()">
	<form id="stuedit">
		<div id="container">
			<div id="nav_links">
				当前位置：学生管理&nbsp;>&nbsp;<span style="color: #1A5CC6;">修改学生信息</span>
			</div>
			<div>
				<div class="input-group">
					<span class="input-group-addon">学号</span> <input
						type="text" class="form-control" name="stuId" id="stuId" readonly="true"/>
				</div>

				<div class="input-group">
					<span class="input-group-addon">姓名</span> <input
						type="text" class="form-control" name="stuName" id="stuName" />
				</div>

				<div class="input-group">
					<span class="input-group-addon">系别</span> <input
						type="text" class="form-control" name="stuAcademy" id="stuAcademy" />
				</div>

				<div class="input-group">
					<span class="input-group-addon">职务</span> <input
						type="text" class="form-control" name="major" id="major" />
				</div>

				<div class="input-group">
					<span class="input-group-addon">出生日期</span> <input
						type="date" class="form-control" name="stuBirth" id="stuBirth" />
				</div>

				<div class="input-group">
					<span class="input-group-addon">入学日期</span> <input
						type="month"  class="form-control" name="entryDate"
						id="entryDate" />
				</div>

				<div class="input-group">
					<span class="input-group-addon">性别</span>
					<div style="margin-top:3px; ">
						&nbsp;&nbsp;&nbsp;&nbsp;男&nbsp;&nbsp;<input type="radio" name="stuGender" class="gcs-radio" id="boy" value="男"/><label for="boy"></label>
						&nbsp;&nbsp;&nbsp;&nbsp;女&nbsp;&nbsp;<input type="radio" name="stuGender" class="gcs-radio" id="girl" value="女"/><label for="girl"></label>
					</div>
					
					<span class="input-group-addon">辅导员</span>
					<div style="margin-top:3px;margin-left:15px;width: 150px;">
						<select id="tno" name="teacherno" style="margin-top:0px;width: 140px;height: 30px;padding-top: 0">
							
						</select>
					</div>
				</div>
				<input class="submit" type="button" id="submit" value="提 交 修 改" />
				
			</div>
		</div>
	</form>
</body>
<script type="text/javascript">
$.ajax({
	type:"post",//请求类型
	url:"/EDUSystem/student/gettnoList.do",//请求路径
	dataType:"json",//响应的数据类型
	data:"",
	success:function suc(dt){//响应成功后的回调函数
		var tb = dt.data;
		for (var i=0;i<tb.length;i++){
			$("#tno").append('<option value="'+tb[i].teachId+'">'+tb[i].teachName+'('+tb[i].teachId+')</option>');
		}

	},
	errer:function err(){
		alert("服务器出现故障")
	}
});

$("#submit").click(function(){
	if(confirm("确认修改?")){
		$.ajax({
			type:"post",//请求类型
			url:"/EDUSystem/student/updatestu.do",//请求路径
			dataType:"json",//响应的数据类型
			data:$("#stuedit").serialize(),
			success:function suc(dt){//响应成功后的回调函数
				if(dt.code==1){
					//window.close();
					alert("修改成功！");
				}else{
					alert(dt.message);
				}
				
				//location.href="stu_list.jsp";
			},
			errer:function err(){
				alert("服务器出现故障")
			}
		});
	}
	
})
$.ajax({
	type:"post",//请求类型
	url:"/EDUSystem/student/getinfo.do?stuId="+getParam("stuId"),
	dataType:"json",//响应的数据类型
	data:"",
	success:function suc(dt){//响应成功后的回调函数
		if(dt.code==1){
			$("#stuId").val(dt.data.stuId);
			$("#stuName").val(dt.data.stuName);
			$("#stuAcademy").val(dt.data.stuAcademy);
			$("#major").val(dt.data.major);
			$("#stuBirth").val(dt.data.stuBirth);
			$("#entryDate").val(dt.data.entryDate);
			if(dt.data.stuGender=='男'){
				$("#boy").attr("checked",'checked');
			}else if(dt.data.stuGender=='女'){
				$("#girl").attr("checked",'checked');
			}
			$("#tno").val(dt.data.teacherno);
		}
	},
	errer:function err(){
		alert("服务器出现故障")
	}
});


function getParam(paramName) {
	paramValue = "", isFound = !1;
	if(this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
		arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;
		while(i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
	}
	return paramValue == "" && (paramValue = null), paramValue
}
</script>
</html>